<?php

    $status = (null) ? 'closed' : 'open';
    $url = 'index.php?dir=' . $dir . '&sub=' . $sub;
    
    if ($giftRegistrys) {
	
	echo '<h4 class="' . $status . '" onclick="swap(this);">Gift Registries (' . sizeof($giftRegistrys) . ')</h4>';
	echo '<div>';
        echo '<table><tbody>';
        
        echo '<tr><th>#</th><th>ID</th><th>Vendor</th><th>Location</th></tr>';
	
        foreach ($giftRegistrys as $i=>$giftRegistry) {
            $vendor = $giftRegistry->getVendor();
            $address = $vendor->getAddress();
            echo '<tr>';
            echo '<td>' . $i . '</td>';
            echo '<td>' . $giftRegistry->getId() . '</td>';
            echo '<td><a href="&vendorId=' . $vendor->getId() . '">' . $vendor->getTitle() . '</a></td>';
            echo '<td><a href"$addressId=">' . $address->getId() . '">' . $address->getAddress() . '</a></td>';
            // might need online registry info (i.e. website link)
            
            echo '</tr>';
        }
        echo '</tbody></table>';
        
    } else {
	
	echo '<h4>There are no Gift Registries!</h4>';
	echo '<div>';

    }
    echo '</div>';
    echo '<button class="create" onclick="window.location="' . $url . '&act=edit">Add Gift Registry</button>';
    
?>